Python: document keyed web search with Serply MCP - #8319
Serply (googio) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The documentation is internally consistent, scoped appropriately, and provides a complete runnable example.
Pull request overview
Adds a documentation-only Serply MCP example demonstrating authenticated web and news search without a model provider account.
Changes:
- Documents dependency installation and
SERPLY_API_KEYsetup. - Adds direct
google_searchandgoogle_news_searchcalls using host-scopedheader_provider. - Describes available tools, output, data transmission, and connection cleanup.
File summaries
| File | Description |
|---|---|
python/samples/02-agents/mcp/README.md |
Adds the keyed Serply MCP walkthrough and prerequisite. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
@microsoft-github-policy-service agree |
Add a README section to the MCP samples showing MCPStreamableHTTPTool against the Serply MCP server with header_provider supplying the X-Api-Key header, calling google_search and google_news_search directly. Adds the SERPLY_API_KEY line under Prerequisites.
9f108f0 to
a852848
Compare
The key is fixed for the process, so static_headers is the right API. A header_provider holds _call_headers_lock for the whole call_tool, which would serialize concurrent Serply searches; static_headers keeps the same origin scoping and cross-origin redirect stripping without that lock.
|
Thanks for the update. Before this is ready, could you please:
Once those are addressed, please re-request review. Thanks! |
|
Thanks, done. The For the record, since it went outdated before it was read: moonbox3 asked for One judgement call I made rather than leave hanging, easy to reverse if you disagree. That leaves it ready for another look. I cannot press re-request review myself: from an outside fork the API answers |
Motivation & Context
The MCP README has an anonymous web search example (Parallel, #8084) and a generic
header_providersample, but no runnable example of a keyed web search server that combines the two. This adds one for the Serply MCP server, which exposes Google, Bing, Google News, Google Scholar, Google Maps, and page scraping tools behind anX-Api-Keyheader.The example reuses the
header_providerpattern frommcp_api_key_auth.py, so the key is scoped toapi.serply.iorequests, and calls the tools directly so it needs no model provider account.I work with Serply, which operates this service.
Description & Review Guide
google_searchandgoogle_news_searchcalls throughMCPStreamableHTTPToolwithheader_provider. One line under Prerequisites forSERPLY_API_KEY.SERPLY_API_KEYare unaffected.main(it needs the ambientheader_providerhandshake fix from Python: preserve MCP request ownership on low-level sends #8246). Against the releasedagent-framework-core1.18.0 wheel withmcp1.30 the initialize request goes out without the header and Serply answers 401, so the example will start working for wheel users with the next release.Verification: ran the exact code block from the README with
agent-framework-coreinstalled from this branch and a live key. Output listed the nine Serply tools, three web results with title, URL, and snippet, and a list of news articles. Ranruff checkandruff format --checkon the snippet with the repo config. No non-ASCII characters were added.Related Issue
None. This follows the shape of #8084, which added the Parallel section without an issue.
Contribution Checklist